<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>IFOnlyRT:  Fichier source de /home/digitalguru/IFOnlyRT$/IFOnlyRT/Basics/CColor.hpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Généré par Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Page&nbsp;principale</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Liste&nbsp;des&nbsp;fichiers</span></a></li>
    </ul>
  </div>
<h1>/home/digitalguru/IFOnlyRT$/IFOnlyRT/Basics/CColor.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CCOLOR_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CCOLOR_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="comment">// Copyright (C) 2002 IFOnlyRT Project.</span>
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="comment">// This program is free software: you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU General Public License as published by</span>
<a name="l00007"></a>00007 <span class="comment">// the Free Software Foundation, version 2.0.</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 <span class="comment">// This program is distributed in the hope that it will be useful,</span>
<a name="l00010"></a>00010 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00011"></a>00011 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00012"></a>00012 <span class="comment">// GNU General Public License 2.0 for more details.</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="comment">// A copy of the GPL 2.0 should have been included with the program.</span>
<a name="l00015"></a>00015 <span class="comment">// If not, see http://www.gnu.org/licenses/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="comment">// Official SVN repository and contact information can be found at</span>
<a name="l00018"></a>00018 <span class="comment">// http://code.google.com/p/ifonlyrt/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="comment">/*</span>
<a name="l00021"></a>00021 <span class="comment"> * CColor.hpp</span>
<a name="l00022"></a>00022 <span class="comment"> *</span>
<a name="l00023"></a>00023 <span class="comment"> *  Created on: 16 oct. 2009</span>
<a name="l00024"></a>00024 <span class="comment"> *      Author: Maxime Gaudin</span>
<a name="l00025"></a>00025 <span class="comment"> */</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="preprocessor">#ifndef UINT</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">        #define UINT</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>        <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> uint;
<a name="l00032"></a>00032 <span class="preprocessor">#endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00037"></a><a class="code" href="classCColor.html">00037</a> <span class="keyword">class </span><a class="code" href="classCColor.html">CColor</a> {
<a name="l00038"></a>00038         <span class="keyword">public</span>:
<a name="l00043"></a><a class="code" href="classCColor.html#120b5056100dc8845f0f5bec6e8b3609">00043</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#120b5056100dc8845f0f5bec6e8b3609">Black</a>;
<a name="l00044"></a>00044 
<a name="l00049"></a><a class="code" href="classCColor.html#d9873f156421f3b26b11504a7e05d19a">00049</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#d9873f156421f3b26b11504a7e05d19a">White</a>;
<a name="l00050"></a>00050 
<a name="l00055"></a><a class="code" href="classCColor.html#2d109be78658c5719551a5aae7412d26">00055</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#2d109be78658c5719551a5aae7412d26">Red</a>;
<a name="l00056"></a>00056 
<a name="l00061"></a><a class="code" href="classCColor.html#16c33d59ad6d1cb76ed318e15a10ebd8">00061</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#16c33d59ad6d1cb76ed318e15a10ebd8">Green</a>;
<a name="l00062"></a>00062 
<a name="l00067"></a><a class="code" href="classCColor.html#c99ac38c19fc34bbc1508808406de58c">00067</a>                 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#c99ac38c19fc34bbc1508808406de58c">Blue</a>;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069         <span class="keyword">public</span>:
<a name="l00074"></a>00074                 <a class="code" href="classCColor.html#deaf21b63271a2a9d18d92f22cb59a2f">CColor</a>();
<a name="l00075"></a>00075 
<a name="l00082"></a>00082                 <a class="code" href="classCColor.html#deaf21b63271a2a9d18d92f22cb59a2f">CColor</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">R</a>, <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">G</a>, <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">B</a>);
<a name="l00083"></a>00083 
<a name="l00088"></a>00088                 <a class="code" href="classCColor.html#deaf21b63271a2a9d18d92f22cb59a2f">CColor</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> Value);
<a name="l00089"></a>00089 
<a name="l00094"></a>00094                 <a class="code" href="classCColor.html#deaf21b63271a2a9d18d92f22cb59a2f">CColor</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00095"></a>00095 
<a name="l00096"></a>00096         <span class="keyword">public</span>:
<a name="l00100"></a>00100                 <span class="keywordtype">void</span> <a class="code" href="classCColor.html#09e6ee1365ba5e7d66a5287e286e3c80">Saturate</a>();
<a name="l00101"></a>00101 
<a name="l00102"></a>00102         <span class="keyword">public</span>:
<a name="l00107"></a>00107                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#81008cfc831768a509dbf72dc7bae9fc">operator =</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00108"></a>00108 
<a name="l00113"></a>00113                 <span class="keywordtype">double</span> <a class="code" href="classCColor.html#f53fd3e61a042a6fdf1588b8efd3fed6">operator []</a>(<span class="keyword">const</span> uint i) <span class="keyword">const</span>;
<a name="l00114"></a>00114 
<a name="l00119"></a>00119                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#501701cd8132e7e2905fcc04ea4b5a92">operator +</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00120"></a>00120 
<a name="l00125"></a>00125                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#19fd50ea72cb54ebe8c3105c227c6103">operator +=</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00126"></a>00126 
<a name="l00131"></a>00131                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#1983a241def72fdf582220ac7bdb13c9">operator -</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00132"></a>00132 
<a name="l00137"></a>00137                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#7d9f518996b6243470f9f2c6664b4a5b">operator -=</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00138"></a>00138 
<a name="l00143"></a>00143                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#942a8e9a76bb67d5fbb6c148738df0b4">operator *</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> Scalar);
<a name="l00144"></a>00144 
<a name="l00149"></a>00149                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#068145e18b1b064a10a2f33283e2b52e">operator *=</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> Scalar);
<a name="l00150"></a>00150 
<a name="l00155"></a>00155                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#277d6b274bf8786c5718e5a9a540e830">operator /</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> Scalar);
<a name="l00156"></a>00156 
<a name="l00161"></a>00161                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#0f1bc14a44eaa608e0dfd70af69347f7">operator /=</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> Scalar);
<a name="l00162"></a>00162 
<a name="l00167"></a>00167                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#942a8e9a76bb67d5fbb6c148738df0b4">operator *</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00168"></a>00168 
<a name="l00173"></a>00173                 <a class="code" href="classCColor.html">CColor</a> <a class="code" href="classCColor.html#068145e18b1b064a10a2f33283e2b52e">operator *=</a>(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2);
<a name="l00174"></a>00174 
<a name="l00175"></a>00175         <span class="keyword">public</span>:
<a name="l00179"></a><a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">00179</a>                 <span class="keywordtype">double</span> <a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">R</a>;
<a name="l00180"></a>00180 
<a name="l00184"></a><a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">00184</a>                 <span class="keywordtype">double</span> <a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">G</a>;
<a name="l00185"></a>00185 
<a name="l00189"></a><a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">00189</a>                 <span class="keywordtype">double</span> <a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">B</a>;
<a name="l00190"></a>00190 };
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator ==(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C1, <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2)
<a name="l00193"></a>00193 {
<a name="l00194"></a>00194         <span class="keywordflow">if</span>(C1.<a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">R</a> != C2.<a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">R</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00195"></a>00195         <span class="keywordflow">if</span>(C1.<a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">G</a> != C2.<a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">G</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00196"></a>00196         <span class="keywordflow">if</span>(C1.<a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">B</a> != C2.<a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">B</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator !=(<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C1, <span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C2)
<a name="l00202"></a>00202 { <span class="keywordflow">return</span> !(C1 == C2); }
<a name="l00203"></a>00203 
<a name="l00204"></a>00204 <span class="keyword">inline</span> std::ostream&amp; operator &lt;&lt;(std::ostream&amp; outStream,<span class="keyword">const</span> <a class="code" href="classCColor.html">CColor</a>&amp; C1)
<a name="l00205"></a>00205 {
<a name="l00206"></a>00206         outStream &lt;&lt; std::string(<span class="stringliteral">"{R = "</span>);
<a name="l00207"></a>00207         outStream &lt;&lt; C1.<a class="code" href="classCColor.html#5f5d9de04da82e4987eadb7422d95b2e">R</a> &lt;&lt; <span class="stringliteral">", G = "</span>;
<a name="l00208"></a>00208         outStream &lt;&lt; C1.<a class="code" href="classCColor.html#878f8160afe01a3827b36b1e28257df1">G</a> &lt;&lt; <span class="stringliteral">", B = "</span>;
<a name="l00209"></a>00209         outStream &lt;&lt; C1.<a class="code" href="classCColor.html#69992ac06d6f51697d8349dd897ece6a">B</a> &lt;&lt; <span class="stringliteral">"}"</span>;
<a name="l00210"></a>00210         <span class="keywordflow">return</span> outStream;
<a name="l00211"></a>00211 }
<a name="l00212"></a>00212 <span class="preprocessor">#endif </span><span class="comment">/* CCOLOR_H_ */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Généré le Thu Oct 22 19:37:51 2009 pour IFOnlyRT par&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>
